// 聊天室 会员列表
<template>
    <div>
        <ChatRoomMenu v-on:tochatroom='toChatRoomFun' v-on:opensuper='onGetSuperior' v-on:touserlist='toUserListFun' v-on:adduser='onAddUser'></ChatRoomMenu>
        <!-- 在线人数 -->
        <OnlineNumber :isShow='isShow' v-on:send='onSendFun' v-if='$store.state.userInfo.member_type_int != 0'></OnlineNumber>
        <!-- 用户列表 -->
        <ChatRoomUserList v-if='!isChatRoom'></ChatRoomUserList>
        <!-- 聊天框 -->
        <ChatRoomBox v-if="isChatRoom" v-on:openwin='onSendFun'></ChatRoomBox>
        <!-- 创建群 -->
        <GroupChatWin :isModel='isGroupWin' :typeN='typeN' v-on:close='onCloseSendWin'></GroupChatWin>
        <!-- 新增用户 -->
        <AddUserWin :isModel='isAddUserWin' :addWinData='addWinData' v-on:close='onCloseAddFun'></AddUserWin>
    </div>
</template>
<script>
import ChatRoomMenu from './assembly/chatRoomMenu'
import OnlineNumber from './assembly/onlineNumber'
import ChatRoomUserList from './assembly/chatRoomUserList'
import ChatRoomBox from './assembly/chatRoomBox'
import GroupChatWin from './assembly/groupChatWin'
import AddUserWin from './assembly/addUserWin'
export default {
    components: {
        ChatRoomMenu,
        OnlineNumber,
        ChatRoomUserList,
        ChatRoomBox,
        GroupChatWin,
        AddUserWin
    },
    data () {
        return {
            isShow:false,
            isChatRoom:true,
            isGroupWin:false, //控制发起群聊窗口
            isAddUserWin:false, //控制新增用户窗口
            typeN:'',
            addWinData:{}, //新增窗口数据
        }
    },
    methods: {
        toChatRoomFun(){
            this.isChatRoom = true;
            this.isShow = false;
        },
        toUserListFun(){
            this.isChatRoom = false;
            this.isShow = true;
        },
        onSendFun(val){ //发送群消息
            this.isGroupWin = true;
            this.typeN = val.toString();
        },
        onCloseSendWin(){ //关闭群管理窗口
             this.isGroupWin = false;
        },
        onAddUser(){ //打开新增用户窗口
            let uid = this.$store.state.userInfo.id;
            this.https('user/getObtainUserMemberCount',{uid:uid})
            .then(data => {
               this.addWinData = data;
               this.isAddUserWin = true;
            })  
        },
        onCloseAddFun(){ //关闭新增用户窗口
            this.isAddUserWin = false;
        },
        onGetSuperior(){
            this.isChatRoom = true;
            this.isShow = false;
        }
    }
}
</script>
<style lang="less" scoped>
@import url(../../assets/css/chatroom/membershiplist.less);
</style>

